package com.psy.price.recorder.domain;

import java.sql.Date;
import java.util.List;
import yenwen.bigheadfactory.webservice.dto.AmzOfferDTO;
import yenwen.bigheadfactory.webservice.dto.DirectTextbookInfoDTO;
import yenwen.bigheadfactory.webservice.dto.HalfOfferDTO;

public class Record {

	public Record(String isbn13, int salesRank, List<DirectTextbookInfoDTO> bB,
			AmzOfferDTO[] a, HalfOfferDTO[] h, Date date) {
		super();
		this.isbn13 = isbn13;
		this.salesRank = salesRank;
		BB = bB;
		A = a;
		H = h;
		this.date = date;
	}

	private String isbn13;

	private int salesRank;

	private List<DirectTextbookInfoDTO> BB;

	private AmzOfferDTO[] A;

	private HalfOfferDTO[] H;

	private Date date;

	public AmzOfferDTO[] getA() {
		return A;
	}

	public void setA(AmzOfferDTO[] a) {
		A = a;
	}

	public List<DirectTextbookInfoDTO> getBB() {
		return BB;
	}

	public void setBB(List<DirectTextbookInfoDTO> bB) {
		BB = bB;
	}

	public HalfOfferDTO[] getH() {
		return H;
	}

	public void setH(HalfOfferDTO[] h) {
		H = h;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getIsbn13() {
		return isbn13;
	}

	public void setIsbn13(String string) {
		this.isbn13 = string;
	}

	public int getSalesRank() {
		return salesRank;
	}

	public void setSalesRank(int salesRank) {
		this.salesRank = salesRank;
	}

	@Override
	public String toString (){

		StringBuffer sb = new StringBuffer();

		sb.append(this.getClass().getName());
		sb.append("\n");
		sb.append(this.getIsbn13()+"\n");
		sb.append("SalesRank: "+ this.getSalesRank()+"\n");
		sb.append("Date: "+this.getDate()+"\n");
		int i = 1;
		for (AmzOfferDTO amz:A){
			sb.append("A"+i+" ");
			sb.append(amz.getSellerName()+" ");
			sb.append(amz.getOfferPrice()+" ");
			sb.append(amz.getQuantity()+"\n");
			i++;
		}
		i=1;
		for (DirectTextbookInfoDTO buyback:BB){
			sb.append("BB"+i+" ");
			sb.append(buyback.getCompanyName()+" ");
			sb.append(buyback.getPrice()+"\n");
			i++;
		}

		return sb.toString();

	}


}
